package WinterFlower.work0716;

/**
 */
public class StringBuffer02 {
    public static void main(String[] args) {
        String url = "http://localhost:8080/admin/table/tablelist.html";
        StringBuffer sbf = new StringBuffer(url);

        String find = "8080";
        String port = "9000";
//            开始下标包括，结束下标不包括

        int index = sbf.indexOf(find);
        sbf.replace(index,index+find.length(),port);
        url = sbf.toString();
        System.out.println(url);

        int lastIndex = sbf.lastIndexOf("table");
        sbf.delete(lastIndex,lastIndex+5);
        url = sbf.toString();
        System.out.println(url);

        sbf.insert(4,"s");
        url = sbf.toString();
        System.out.println(url);

        String src = "2442";
        StringBuffer sbf2 = new StringBuffer(src);
        String dest = sbf2.reverse().toString();

        if(src.equals(dest)){
            System.out.println("是回文");
        }
    }

}
